package com.neu.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.neu.domain.CaseHistory;
import com.neu.mapper.CaseHistoryMapper;
import com.neu.service.CaseHistoryService;
import com.neu.service.RegisteredService;

//应该交给spring的容器来管理,而不是springMVC容器

@Service("caseHistoryService")
public class CaseHistoryServiceImpl implements CaseHistoryService{
	@Autowired
	private CaseHistoryMapper caseHistoryMapper;
	@Autowired
	private RegisteredService registeredService;

	@Override
	public boolean addCaseHistory(CaseHistory caseHistory, Integer personid) {
		//事务处理 :插入和更新 
		//生成病历的同时更改用户的就诊状态为已就诊
		boolean temp=false;
		int row1=caseHistoryMapper.addCaseHistory(caseHistory, personid);
		int row2=registeredService.updateSeeindSateByPersonid(personid);
		if(row1>0 && row2>0) {
			temp=true;
		}
		return temp;
	}
	
	
	
	
}